package javaapplication1;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class JavaApplication1
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException
    {
        
        FileInputStream in = new FileInputStream("Names.txt");
        Scanner scan = new Scanner(in);
        FileOutputStream out = new FileOutputStream("Report2.txt");
        PrintWriter wr = new PrintWriter(out);
        
        wr.println("The first number is the number of collisions, the second is the length and the third is number of the read words");
        
        Hash H = new Hash(1);

        int n = 0;
        int c = 0;
        
        while (scan.hasNextLine())
        {
            String S = scan.next();
            char T[] = S.toCharArray();
            
            char V = T[0];
            ArrayList<Character> C = new ArrayList<Character>();
            
            int i = 1;
            
            while (i<=T.length)
            {
            while ((V != ' ')&&(i<=T.length))
            {
                C.add(V);
                if (i<T.length) V = T[i];
                i++;
            }
                
            char C2[] = new char[C.size()]; 
            
            for (int j = 0; j < C.size(); j++)
            {
                C2[j] = C.get(j);           
            }
            
            if (  (c = H.Add(C2))!=0)
            {
                n++;
                wr.println("Report #" + n + ": " + (c-1) + " " + H.size() + " " + H.num_of_words);
            }
            i++;
        }
        }

        System.out.print( H.GetCount("Peter".toCharArray()) );
        wr.close();
    }

}
